package com.example.tse.rbyair.util;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import com.example.tse.rbyair.PKactivity.ActivityFragment;
import com.example.tse.rbyair.PKhome.HomeFragment;
import com.example.tse.rbyair.PKmy.fragment.MeFragment;
import com.example.tse.rbyair.PKshopcar.ShoppingCarFragment;
import com.example.tse.rbyair.PKwebview.WebViewFragment;

/**
 * Created by hp on 16/1/26.
 */
public class FragmentAdapter extends FragmentStatePagerAdapter {

    Context mContext;

    public FragmentAdapter(FragmentManager fm, Context context) {
        super(fm);
        this.mContext = context;
    }

    @Override
    public Fragment getItem(int arg0) {
        Fragment fragment = null;
        switch (arg0) {
            case 0:
                fragment = new WebViewFragment();
                break;
            case 1:
                fragment = new ActivityFragment();
                break;
            case 2:
                fragment = new HomeFragment();
                break;
            case 3:
                fragment = new ShoppingCarFragment();
                break;
            case 4:
                fragment = new MeFragment();
                break;
            default:
                fragment = new WebViewFragment();
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return 5;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);

    }


}
